package io.dy.utils;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

/**
 * @author : dmj
 * @date: 2024/6/6 10:49 上午
 * @description:
 */
public class DateUtils {



    public static Date specialHandleDateHMS(Date needHandleDate, int hourOfDay, int minute, int second){
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Asia/Shanghai"));
        calendar.clear();
        calendar.setTime(needHandleDate);
        calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
        calendar.set(Calendar.MINUTE, minute);
        calendar.set(Calendar.SECOND, second);
        return calendar.getTime();
    }


    public static void main(String[] args) {
        System.out.println(specialHandleDateHMS(new Date(), 23, 59, 59));
    }
}
